package coding.unit11;

import java.util.ArrayList;

/**
 * @author Wang Renlei
 * @Date 2020/5/6
 */

class Apple {
    private static long counter;
    private final long id = counter++;

    public long id() {
        return id;
    }
}

class Orange {
}

public class ApplesAndOrangesWithoutGenerics {

    public static void main(String[] args) {
        @SuppressWarnings("unchecked")
        ArrayList<Apple> apples = new ArrayList();
        for (int i = 0; i < 3; i++) {
            apples.add(new Apple());
        }
//        apples.add(new Orange());
        for (Apple apple : apples) {
            System.out.println(apple.id());

        }
    }
}
